home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / m17n / vi-vni.mim < prev    next >
Text File  |  2009-04-29  |  5KB  |  160 lines

  1. ;; vi-vni.mim -- Input method for Vietnames with VNI key sequence
  2. ;; Copyright (C) 2005, 2008
  3. ;;   National Institute of Advanced Industrial Science and Technology (AIST)
  4. ;;   Registration Number H15PRO112
  5.  
  6. ;; This file is part of the m17n database; a sub-part of the m17n
  7. ;; library.
  8.  
  9. ;; The m17n library is free software; you can redistribute it and/or
  10. ;; modify it under the terms of the GNU Lesser General Public License
  11. ;; as published by the Free Software Foundation; either version 2.1 of
  12. ;; the License, or (at your option) any later version.
  13.  
  14. ;; The m17n library is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. ;; Lesser General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU Lesser General Public
  20. ;; License along with the m17n library; if not, write to the Free
  21. ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. ;; Boston, MA 02110-1301, USA.
  23.  
  24. (input-method vi vni)
  25.  
  26. (description (_"Vietnames input method using the VNI key sequence.
  27. Typing Backslash ('\\') toggles the normal mode and English mode.
  28. The following variables are customizable:
  29.   tone-mark-on-last: control tone mark position in equivocal cases
  30.   backspace-is-undo: control the action of Backspace key (delete or undo)"))
  31.  
  32. (title "ß║«(VNI)")
  33.  
  34. (variable
  35.  (tone-mark-on-last
  36.   (_"Flag to control tone mark position in equivocal cases.
  37. If this variable is 0 (the default), put tone mark on the first vowel
  38. in such equivocal cases as \"oa\", \"oe\", \"uy\".
  39. Otherwise, put tone mark on the last vowel.")
  40.   0 0 1)
  41.  
  42.  (backspace-is-undo
  43.   (_"Flag to control the action of Backspace key (delete or undo).
  44. If this variable is 0 (the default), Backspace key deletes the previous
  45. character (e.g. \"q u a i s BS\" => \"qu├í\").
  46. If the value is 1, Backspace key undoes the previous key
  47. \(e.g. \"q u a i s BS\" => \"quai\").")
  48.   0 0 1))
  49.  
  50. (include (t nil vi-base) macro)
  51. (include (t nil vi-base) map)
  52.  
  53. (map
  54.  (vowel-ext
  55.   ("a6" ("├óß║Ñß║ºß║⌐ß║½ß║¡")) ("A6" ("├éß║ñß║ªß║¿ß║¬ß║¼"))
  56.   ("a8" ("─âß║»ß║▒ß║│ß║╡ß║╖")) ("A8" ("─éß║«ß║░ß║▓ß║┤ß║╢"))
  57.   ("e6" ("├¬ß║┐ß╗üß╗âß╗àß╗ç")) ("E6" ("├èß║╛ß╗Çß╗éß╗äß╗å"))
  58.   ("o6" ("├┤ß╗æß╗ôß╗òß╗ùß╗Ö")) ("O6" ("├öß╗Éß╗Æß╗öß╗ûß╗ÿ"))
  59.   ("o7" ("╞íß╗¢ß╗¥ß╗ƒß╗íß╗ú")) ("O7" ("╞áß╗Üß╗£ß╗₧ß╗áß╗ó"))
  60.   ("u7" ("╞░ß╗⌐ß╗½ß╗¡ß╗»ß╗▒")) ("U7" ("╞»ß╗¿ß╗¬ß╗¼ß╗«ß╗░")))
  61.  
  62.  (consonant-ext
  63.   ("d9" ?─æ) ("D9" ?─É))
  64.  
  65.  (tone-mark
  66.   ("0" (set SELECT 0) ?0)
  67.   ("1" (set SELECT 1) ?1)
  68.   ("2" (set SELECT 2) ?2)
  69.   ("3" (set SELECT 3) ?3)
  70.   ("4" (set SELECT 4) ?4)
  71.   ("5" (set SELECT 5) ?5))
  72.  
  73.  (temporary-escape
  74.   ("a66" "a6") ("A66" "A6")
  75.   ("a88" "a8") ("A88" "A8")
  76.   ("e66" "e6") ("E66" "E6")
  77.   ("o66" "o6") ("O66" "O6")
  78.   ("o77" "o7") ("O77" "O7")
  79.   ("u77" "u7") ("U77" "U7")))
  80.  
  81. (state
  82.  (init
  83.   ;; Initialize variables.  C is the initial consonant.  V-N is the
  84.   ;; (N-1)th vowel from the last.  C-AFTER-V is a number of consonants
  85.   ;; typed after vowel.
  86.   (t (set C @-1) (set V-1 0) (set V-2 0) (set V-3 0) (set C-AFTER-V 0)
  87.      (set SELECT 0))
  88.  
  89.   (consonant (set C @-1))
  90.   (consonant-ext (set C @-1))
  91.   ;; Mark M remembers the preedit position after the last vowel.
  92.   (vowel (mark M) (set V-2 V-1) (set V-1 @-1) (shift after-v))
  93.   (vowel-ext (mark M) (set V-2 V-1) (set V-1 @-1) (shift after-v))
  94.   (temporary-escape (shift temporary-escape))
  95.   (permanent-escape (shift escape-in-normal-mode)))
  96.  
  97.  ;; The state shifted to when a vowel is typed.
  98.  (after-v
  99.   (consonant (shift after-vc))
  100.   (consonant-ext (shift after-vc))
  101.   (vowel (mark M) (set V-3 V-2) (set V-2 V-1) (set V-1 @-1)
  102.      (move T) (select 0) (handle-mark) (move M))
  103.   (vowel-ext (mark M) (set V-3 V-2) (set V-2 V-1) (set V-1 @-1)
  104.          (move T) (select 0) (handle-mark) (move M))
  105.   (tone-mark (delete @-) (pushback 1) (shift after-t))
  106.   (backspace (delete @-)
  107.          (cond (V-3 (set V-1 V-2) (set V-2 V-3) (set V-3 0)
  108.             (cond ((> TPLACE 2) (set SELECT 0))))
  109.            (V-2 (set V-1 V-2) (set V-2 0)
  110.             (cond ((> TPLACE 1) (set SELECT 0))))
  111.            (1 (shift init)))))
  112.  
  113.  ;; The state shifted to when a consonant is typed after a vowel.
  114.  (after-vc
  115.   (t (set C-AFTER-V 1))
  116.   (consonant (add C-AFTER-V 1))
  117.   (consonant-ext (add C-AFTER-V 1))
  118.   (tone-mark (delete @-) (pushback 1) (shift after-t))
  119.   (backspace (delete @-)
  120.          (sub C-AFTER-V 1)
  121.          (cond ((= C-AFTER-V 0) (shift after-v)))))
  122.  
  123.  ;; The state shifted to when a tone-mark is typed.
  124.  (after-t
  125.   (t (set CURRENT-SELECT -1))
  126.   (tone-mark (cond ((= CURRENT-SELECT SELECT) (move T) (select 0) (move @>)
  127.             (shift temporary-escape))
  128.            (1 (delete @-) (handle-mark) (set CURRENT-SELECT SELECT))))
  129.   (nil (cond (C-AFTER-V (shift after-vc))
  130.          (1 (shift after-v)))))
  131.  
  132.  (temporary-escape
  133.   "en"
  134.   (t (commit))
  135.   (alnum (commit)))
  136.  
  137.  (escape-in-normal-mode
  138.   "EN"
  139.   (permanent-escape (insert "\\") (shift init))
  140.   ;; Any other key force shifting to permanent-escape.
  141.   (nil (shift permanent-escape)))
  142.  
  143.  (permanent-escape
  144.   "EN"
  145.   (t (set ESCAPE 1))
  146.   (permanent-escape (shift escape-in-permanent-escape))
  147.   ;; Unhandle any characters.
  148.   (nil (unhandle)))
  149.  
  150.  (escape-in-permanent-escape
  151.   "ß║«"
  152.   (permanent-escape (insert "\\") (commit) (shift permanent-escape))
  153.   ;; Any other key force shifting to init
  154.   ))
  155.  
  156. ;; Local Variables:
  157. ;; coding: utf-8
  158. ;; mode: lisp
  159. ;; End:
  160.